package com.yangzhe.video;

import android.app.Application;

import com.yangzhe.base.AppContext;
import com.yangzhe.base.BaseChildApplication;
import com.yangzhe.base.communication.FunctionA;
import com.yangzhe.base.communication.FunctionBus;
import com.yangzhe.video.global.Config;
import com.yangzhe.video.utils.PageFactory;

import org.litepal.LitePalApplication;


/**
 * Created by Nirui on 17/2/21.
 */

public class ReaderApp extends BaseChildApplication {

  @Override public void onCreate() {
    super.onCreate();
    //给底层library设置context
    AppContext.init(getApplicationContext());
  }

  /**
   * 作为library时需要初始化的内容
   */
  @Override public void onCreateAsLibrary(Application application) {
    super.onCreateAsLibrary(application);

    LitePalApplication.initialize(application);
    Config.createConfig(application);
    PageFactory.createPageFactory(application);
    //给FunctionBus传入已实现的公开方法的实例
    FunctionBus.setFunction(new FunctionA() {
      @Override public String getData(String key) {
        return "xixi";
      }
    });
  }


}
